package powell.nflpredictionproject.display;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import powell.nflpredictionproject.database.InformationFromDB;

/**
 *
 * @author Verti_000
 */
public class ResultPanel extends JFrame
{
    private ImageIcon image = new ImageIcon("NFLLogo.jpg");
    private JPanel buttonPanel = new JPanel();
    private JButton resetButton = new JButton("Reset");
    private JButton exitButton = new JButton("Exit");
    private JLabel output = new JLabel("Default");
    private JLabel pictureLabel = new JLabel(image);
    private InformationFromDB stats = new InformationFromDB();
    private UserPanel teams = new UserPanel();
    public JPanel tempPanel = new JPanel(new BorderLayout());
        
    public ResultPanel()
    {
        this.setBounds(300, 100, 1500, 1500);
        
        output.setForeground(Color.WHITE);
        
        buttonPanel.add(resetButton);
        buttonPanel.add(exitButton);
        
        resetButton.addActionListener(new ResetListener());
        
        exitButton.addActionListener(new ExitListener());
        
        buttonPanel.setBackground(Color.BLACK);
        
        this.getContentPane().setBackground(Color.BLACK);
        
        this.setTitle("Prediction Of A Winner");
        
        output.setFont(new Font("Serif", Font.PLAIN, 28));
        
        output.setHorizontalAlignment(SwingConstants.CENTER);
        
        this.setLayout(new GridLayout(4, 1));
        
        this.add(output);
        
        this.add(tempPanel);
        
        this.add(pictureLabel);
        
        this.add(buttonPanel);
        
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        
        this.setResizable(false);
        
        this.setVisible(true);
    }
    
    public void setOutputText(String text) {
        output.setText(text);
    }
    
   private void closeMe() {
        this.setVisible(false);
        this.dispose();
    }

    private class ExitListener implements ActionListener
    {

        @Override
        public void actionPerformed(ActionEvent e)
        {
            System.exit(1);
        }
    }

    private class ResetListener implements ActionListener
    {

        @Override
        public void actionPerformed(ActionEvent e)
        {
            MainPanel newWindow = new MainPanel();
            closeMe();
        }
    }
}
